import { keyBy } from 'lodash-es';
import { GetSmartDeviceModelDpSchema } from '@ray-js/panel-sdk';

export const lampSchema = [
  {
    attr: 641,
    canTrigger: true,
    code: 'switch_led',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_power',
    id: 20,
    mode: 'rw',
    name: '开关',
    property: {
      type: 'bool',
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'work_mode',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_mode',
    id: 21,
    mode: 'rw',
    name: '模式',
    property: {
      range: ['white', 'colour', 'scene', 'music'],
      type: 'enum',
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'bright_value',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-liangdu1',
    id: 22,
    mode: 'rw',
    name: '亮度值',
    property: {
      min: 10,
      max: 1000,
      scale: 0,
      step: 1,
      type: 'value',
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'temp_value',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_half',
    id: 23,
    mode: 'rw',
    name: '冷暖值',
    property: {
      min: 0,
      max: 1000,
      scale: 0,
      step: 1,
      type: 'value',
    },
    type: 'obj',
  },
  {
    attr: 512,
    canTrigger: true,
    code: 'colour_data',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_mode',
    id: 24,
    mode: 'rw',
    name: '彩光',
    property: {
      type: 'string',
      maxlen: 255,
    },
    type: 'obj',
  },
  {
    attr: 512,
    canTrigger: true,
    code: 'scene_data',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_mode',
    id: 25,
    mode: 'rw',
    name: '场景',
    property: {
      type: 'string',
      maxlen: 255,
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'countdown',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-a_nav_timer',
    id: 26,
    mode: 'rw',
    name: '倒计时剩余时间',
    property: {
      unit: 's',
      min: 0,
      max: 86400,
      scale: 0,
      step: 1,
      type: 'value',
    },
    type: 'obj',
  },
  {
    attr: 128,
    canTrigger: true,
    code: 'music_data',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_mic',
    id: 27,
    mode: 'wr',
    name: '音乐灯',
    property: {
      type: 'string',
      maxlen: 255,
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'control_data',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_box2',
    id: 28,
    mode: 'wr',
    name: '调节',
    property: {
      type: 'string',
      maxlen: 255,
    },
    type: 'obj',
  },
  {
    attr: 128,
    canTrigger: true,
    code: 'debug_data',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_tool',
    id: 29,
    mode: 'rw',
    name: '调试',
    property: {
      type: 'string',
      maxlen: 255,
    },
    type: 'obj',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'rhythm_mode',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_time3',
    id: 30,
    mode: 'rw',
    name: '生物节律',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'sleep_mode',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_sleep',
    id: 31,
    mode: 'rw',
    name: '入睡',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'wakeup_mode',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_sun',
    id: 32,
    mode: 'rw',
    name: '唤醒',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'power_memory',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_lightning',
    id: 33,
    mode: 'rw',
    name: '断电记忆',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 640,
    canTrigger: true,
    code: 'do_not_disturb',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_sleep',
    id: 34,
    mode: 'rw',
    name: '停电勿扰',
    property: {
      type: 'bool',
    },
    type: 'obj',
  },
  {
    attr: 0,
    canTrigger: true,
    code: 'switch_gradient',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_mode',
    id: 35,
    mode: 'rw',
    name: '开关渐变',
    property: {
      type: 'raw',
      maxlen: 128,
    },
    type: 'raw',
  },
  {
    attr: 512,
    canTrigger: true,
    code: 'white_gradi_time',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_light',
    id: 48,
    mode: 'rw',
    name: '白光渐变时间',
    property: {
      unit: 'ms',
      min: 0,
      max: 10000,
      scale: 0,
      step: 200,
      type: 'value',
    },
    type: 'obj',
  },
  {
    attr: 512,
    canTrigger: true,
    code: 'colour_gradi_time',
    defaultRecommend: true,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_shield',
    id: 49,
    mode: 'rw',
    name: '彩光渐变时间',
    property: {
      unit: 'ms',
      min: 0,
      max: 10000,
      scale: 0,
      step: 200,
      type: 'value',
    },
    type: 'obj',
  },
  {
    attr: 96,
    canTrigger: false,
    code: 'remote_switch',
    defaultRecommend: false,
    editPermission: false,
    executable: false,
    extContent: '',
    iconname: 'icon-dp_power2',
    id: 41,
    mode: 'rw',
    name: 'Wi-Fi遥控器开关',
    property: {
      type: 'bool',
    },
    type: 'obj',
  },
  {
    attr: 0,
    canTrigger: true,
    code: 'candle_mode_data',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-huoyan',
    id: 82,
    mode: 'rw',
    name: '模拟烛光',
    property: {
      type: 'raw',
      maxlen: 128,
    },
    type: 'raw',
  },
  {
    attr: 128,
    canTrigger: true,
    code: 'cycle_timing',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_time',
    id: 209,
    mode: 'rw',
    name: '循环定时',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 128,
    canTrigger: true,
    code: 'random_timing',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_time3',
    id: 210,
    mode: 'rw',
    name: '随机定时',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
  {
    attr: 128,
    canTrigger: true,
    code: 'dreamlight_scene_mode',
    defaultRecommend: false,
    editPermission: false,
    executable: true,
    extContent: '',
    iconname: 'icon-dp_time3',
    id: 210,
    mode: 'rw',
    name: '幻彩情景',
    property: {
      type: 'raw',
      maxlen: 255,
    },
    type: 'raw',
  },
] as const;

export const lampSchemaMap = keyBy(lampSchema, 'code') as GetSmartDeviceModelDpSchema<
  typeof lampSchema
>;
